<?php


namespace app\api\model;


use think\Model;

class UserFoodRecord extends Model
{

    // 表名
    protected $name = 'user_food_record';


    protected $append = ['food_name'];


    public function getFoodNameAttr($name,$data)
    {
        $detail = FoodListModel::get($data['fid']);

        if(empty($detail)){
            return '';
        }

        return $detail['name'];
    }
}